<!-- saved from url=(0014)about:internet -->
<pre class="code">
<span class="srcline"><span class="lineno"><a href="32,1" id="srcline1">  1</a></span><span class="line"><span class="comment">% ------------------------------------------------------------------</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,2" id="srcline2">  2</a></span><span class="line"><span class="comment">% state dynamics</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,3" id="srcline3">  3</a></span><span class="line"><span class="comment">%</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,4" id="srcline4">  4</a></span><span class="line"><span class="comment">% ydot = fy_(t, y , auxdata)</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,5" id="srcline5">  5</a></span><span class="line"><span class="comment">%</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,6" id="srcline6">  6</a></span><span class="line"><span class="comment">% Input argumuents:</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,7" id="srcline7">  7</a></span><span class="line"><span class="comment">% -------------------------------------------------------------------------</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,8" id="srcline8">  8</a></span><span class="line"><span class="comment">% t                    [1x1 double]          time                     [ TU]        </span></span></span>
<span class="srcline"><span class="lineno"><a href="32,9" id="srcline9">  9</a></span><span class="line"><span class="comment">% y                   [14x1 double]          state variables     [  -  ]</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,10" id="srcline10"> 10</a></span><span class="line"><span class="comment">% auxdata       [structure]               parameters         [  -  ]</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,11" id="srcline11"> 11</a></span><span class="line"><span class="comment">%</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,12" id="srcline12"> 12</a></span><span class="line"><span class="comment">% Output argumuents:</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,13" id="srcline13"> 13</a></span><span class="line"><span class="comment">% -------------------------------------------------------------------------</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,14" id="srcline14"> 14</a></span><span class="line"><span class="comment">% ydot              [7x1 double]          vector field           [  -  ]</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,15" id="srcline15"> 15</a></span><span class="line"><span class="comment">%</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,16" id="srcline16"> 16</a></span><span class="line"><span class="comment">% External functions called:</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,17" id="srcline17"> 17</a></span><span class="line"><span class="comment">% -------------------------------------------------------------------------</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,18" id="srcline18"> 18</a></span><span class="line"><span class="comment">% None</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,19" id="srcline19"> 19</a></span><span class="line"><span class="comment">%</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,20" id="srcline20"> 20</a></span><span class="line"><span class="comment">% Copyright (C) 2015/06/22 by Chen Zhang, </span></span></span>
<span class="srcline"><span class="lineno"><a href="32,21" id="srcline21"> 21</a></span><span class="line"><span class="comment">% BeiHang University, chenzhang.buaa@gmail.com</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,22" id="srcline22"> 22</a></span><span class="line"><span class="comment">% ------------------------------------------------------------------</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,23" id="srcline23"> 23</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,24" id="srcline24"> 24</a></span><span class="line"><span class="keyword">function</span> <span class="var type1" id="S2T9U3">ydot</span> = fy_(<span class="var type1" id="S3T1U6">t</span> , <span class="var type1" id="S4T9U7">y</span> , <span class="var type1" id="S5T4U8">auxdata</span>)</span></span>
<span class="srcline"><span class="lineno"><a href="32,25" id="srcline25"> 25</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,26" id="srcline26"> 26</a></span><span class="line"><span class="mxinfo" id="T1:U5"><span class="var type1" id="S6T1U11">mu</span> = <span class="mxinfo" id="T1:U7"><span class="var type1" id="S5T4U13">auxdata</span>.mu</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,27" id="srcline27"> 27</a></span><span class="line"><span class="mxinfo" id="T1:U9"><span class="var type1" id="S7T1U17">Tmax</span> = <span class="mxinfo" id="T1:U11"><span class="var type1" id="S5T4U19">auxdata</span>.Tmax</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,28" id="srcline28"> 28</a></span><span class="line"><span class="mxinfo" id="T1:U13"><span class="var type1" id="S8T1U23">c</span> = <span class="mxinfo" id="T1:U15"><span class="var type1" id="S5T4U25">auxdata</span>.c</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,29" id="srcline29"> 29</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,30" id="srcline30"> 30</a></span><span class="line"><span class="comment">% --------------------------------------------------------</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,31" id="srcline31"> 31</a></span><span class="line"><span class="mxinfo" id="T1:U17"><span class="var type1" id="S9T1U29">p</span> = <span class="mxinfo" id="T1:U19"><span class="var type1" id="S4T9U31">y</span>(<span class="mxinfo" id="T1:U21">1</span>)</span></span>; <span class="mxinfo" id="T1:U22"><span class="var type1" id="S10T1U35">ex</span> = <span class="mxinfo" id="T1:U24"><span class="var type1" id="S4T9U37">y</span>(<span class="mxinfo" id="T1:U26">2</span>)</span></span>; <span class="mxinfo" id="T1:U27"><span class="var type1" id="S11T1U41">ey</span> = <span class="mxinfo" id="T1:U29"><span class="var type1" id="S4T9U43">y</span>(<span class="mxinfo" id="T1:U31">3</span>)</span></span>; <span class="mxinfo" id="T1:U32"><span class="var type1" id="S12T1U47">hx</span> = <span class="mxinfo" id="T1:U34"><span class="var type1" id="S4T9U49">y</span>(<span class="mxinfo" id="T1:U36">4</span>)</span></span>; <span class="mxinfo" id="T1:U37"><span class="var type1" id="S13T1U53">hy</span> = <span class="mxinfo" id="T1:U39"><span class="var type1" id="S4T9U55">y</span>(<span class="mxinfo" id="T1:U41">5</span>)</span></span>; <span class="mxinfo" id="T1:U42"><span class="var type1" id="S14T1U59">L</span> = <span class="mxinfo" id="T1:U44"><span class="var type1" id="S4T9U61">y</span>(<span class="mxinfo" id="T1:U46">6</span>)</span></span>; <span class="mxinfo" id="T1:U47"><span class="var type1" id="S15T1U65">m</span> = <span class="mxinfo" id="T1:U49"><span class="var type1" id="S4T9U67">y</span>(<span class="mxinfo" id="T1:U51">7</span>)</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,32" id="srcline32"> 32</a></span><span class="line"><span class="mxinfo" id="T1:U52"><span class="var type1" id="S16T1U71">pp</span> = <span class="mxinfo" id="T1:U54"><span class="var type1" id="S4T9U73">y</span>(<span class="mxinfo" id="T1:U56">8</span>)</span></span>; <span class="mxinfo" id="T1:U57"><span class="var type1" id="S17T1U77">pex</span> = <span class="mxinfo" id="T1:U59"><span class="var type1" id="S4T9U79">y</span>(<span class="mxinfo" id="T1:U61">9</span>)</span></span>; <span class="mxinfo" id="T1:U62"><span class="var type1" id="S18T1U83">pey</span> = <span class="mxinfo" id="T1:U64"><span class="var type1" id="S4T9U85">y</span>(<span class="mxinfo" id="T1:U66">10</span>)</span></span>; <span class="mxinfo" id="T1:U67"><span class="var type1" id="S19T1U89">phx</span> = <span class="mxinfo" id="T1:U69"><span class="var type1" id="S4T9U91">y</span>(<span class="mxinfo" id="T1:U71">11</span>)</span></span>; <span class="mxinfo" id="T1:U72"><span class="var type1" id="S20T1U95">phy</span> = <span class="mxinfo" id="T1:U74"><span class="var type1" id="S4T9U97">y</span>(<span class="mxinfo" id="T1:U76">12</span>)</span></span>; <span class="mxinfo" id="T1:U77"><span class="var type1" id="S21T1U101">pL</span> = <span class="mxinfo" id="T1:U79"><span class="var type1" id="S4T9U103">y</span>(<span class="mxinfo" id="T1:U81">13</span>)</span></span>; <span class="mxinfo" id="T1:U82"><span class="var type1" id="S22T1U107">pm</span> = <span class="mxinfo" id="T1:U84"><span class="var type1" id="S4T9U109">y</span>(<span class="mxinfo" id="T1:U86">14</span>)</span></span>; <span class="comment">% 注意pp冲突</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,33" id="srcline33"> 33</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,34" id="srcline34"> 34</a></span><span class="line"><span class="mxinfo" id="T9:U87"><span class="var type1" id="S2T9U113">ydot</span> = <span class="mxinfo" id="T9:U89">zeros(<span class="mxinfo" id="T1:U90">14</span> , 1)</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,35" id="srcline35"> 35</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,36" id="srcline36"> 36</a></span><span class="line"><span class="comment">% --------------------------------------------------------</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,37" id="srcline37"> 37</a></span><span class="line"><span class="mxinfo" id="T1:U91"><span class="var type1" id="S24T1U120">W</span> = <span class="mxinfo" id="T1:U93"><span class="mxinfo" id="T1:U94"><span class="mxinfo" id="T1:U95">1</span> + <span class="mxinfo" id="T1:U96"><span class="var type1" id="S10T1U125">ex</span> * <span class="mxinfo" id="T1:U98">cos(<span class="var type1" id="S14T1U128">L</span>)</span></span></span> + <span class="mxinfo" id="T1:U100"><span class="var type1" id="S11T1U130">ey</span> * <span class="mxinfo" id="T1:U102">sin(<span class="var type1" id="S14T1U133">L</span>)</span></span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,38" id="srcline38"> 38</a></span><span class="line"><span class="mxinfo" id="T1:U104"><span class="var type1" id="S27T1U136">Z</span> = <span class="mxinfo" id="T1:U106"><span class="mxinfo" id="T1:U107"><span class="var type1" id="S12T1U139">hx</span> * <span class="mxinfo" id="T1:U109">sin(<span class="var type1" id="S14T1U142">L</span>)</span></span> - <span class="mxinfo" id="T1:U111"><span class="var type1" id="S13T1U144">hy</span> * <span class="mxinfo" id="T1:U113">cos(<span class="var type1" id="S14T1U147">L</span>)</span></span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,39" id="srcline39"> 39</a></span><span class="line"><span class="mxinfo" id="T1:U115"><span class="var type1" id="S28T1U150">C</span> = <span class="mxinfo" id="T1:U117"><span class="mxinfo" id="T1:U118"><span class="mxinfo" id="T1:U119">1</span> + <span class="mxinfo" id="T1:U120"><span class="var type1" id="S12T1U155">hx</span>^2</span></span> + <span class="mxinfo" id="T1:U122"><span class="var type1" id="S13T1U158">hy</span>^2</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,40" id="srcline40"> 40</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,41" id="srcline41"> 41</a></span><span class="line"><span class="mxinfo" id="T1:U124"><span class="var type1" id="S29T1U162">Ckep</span> = <span class="mxinfo" id="T1:U126"><span class="mxinfo" id="T1:U127">sqrt(<span class="mxinfo" id="T1:U128"><span class="var type1" id="S9T1U167">p</span> / <span class="var type1" id="S6T1U168">mu</span></span>)</span> / <span class="var type1" id="S24T1U169">W</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,42" id="srcline42"> 42</a></span><span class="line"><span class="mxinfo" id="T16:U132"><span class="var type1" id="S31T16U172">A</span> = <span class="mxinfo" id="T16:U134"><span class="var type1" id="S29T1U174">Ckep</span> * <span class="mxinfo" id="T16:U136">[<span class="mxinfo" id="T1:U137">0</span> ; <span class="mxinfo" id="T1:U138">0</span> ; <span class="mxinfo" id="T1:U139">0</span> ; <span class="mxinfo" id="T1:U140">0</span> ; <span class="mxinfo" id="T1:U141">0</span> ; <span class="mxinfo" id="T1:U142"><span class="mxinfo" id="T1:U143"><span class="mxinfo" id="T1:U144"><span class="var type1" id="S24T1U190">W</span>^3</span> * <span class="var type1" id="S6T1U192">mu</span></span> / <span class="mxinfo" id="T1:U147"><span class="var type1" id="S9T1U194">p</span>^2</span></span>]</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,43" id="srcline43"> 43</a></span><span class="line"><span class="mxinfo" id="T17:U149"><span class="var type1" id="S32T17U198">B</span> = <span class="mxinfo" id="T17:U151"><span class="var type1" id="S29T1U200">Ckep</span> *  <span class="mxinfo" id="T17:U153">[<span class="mxinfo" id="T20:U154"><span class="mxinfo" id="T1:U155">0</span> , <span class="mxinfo" id="T1:U156"><span class="mxinfo" id="T1:U157">2</span>*<span class="var type1" id="S9T1U206">p</span></span> , <span class="mxinfo" id="T1:U159">0</span></span>;</span></span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,44" id="srcline44"> 44</a></span><span class="line"><span class="mxinfo" id="T17:U149"><span class="mxinfo" id="T17:U151"><span class="mxinfo" id="T17:U153">    <span class="mxinfo" id="T20:U160"><span class="mxinfo" id="T1:U161"><span class="var type1" id="S24T1U210">W</span> * <span class="mxinfo" id="T1:U163">sin(<span class="var type1" id="S14T1U213">L</span>)</span></span> , <span class="mxinfo" id="T1:U165"><span class="mxinfo" id="T1:U166">(<span class="mxinfo" id="T1:U167"><span class="var type1" id="S24T1U218">W</span> + <span class="mxinfo" id="T1:U169">1</span></span>) * <span class="mxinfo" id="T1:U170">cos(<span class="var type1" id="S14T1U222">L</span>)</span></span> + <span class="var type1" id="S10T1U223">ex</span></span> , <span class="mxinfo" id="T1:U173"><span class="mxinfo" id="T1:U174">-<span class="var type1" id="S27T1U226">Z</span></span> * <span class="var type1" id="S11T1U227">ey</span></span></span>;</span></span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,45" id="srcline45"> 45</a></span><span class="line"><span class="mxinfo" id="T17:U149"><span class="mxinfo" id="T17:U151"><span class="mxinfo" id="T17:U153">    <span class="mxinfo" id="T20:U177"><span class="mxinfo" id="T1:U178"><span class="mxinfo" id="T1:U179">-<span class="var type1" id="S24T1U231">W</span></span> * <span class="mxinfo" id="T1:U181">cos(<span class="var type1" id="S14T1U234">L</span>)</span></span> , <span class="mxinfo" id="T1:U183"><span class="mxinfo" id="T1:U184">(<span class="mxinfo" id="T1:U185"><span class="var type1" id="S24T1U239">W</span> + <span class="mxinfo" id="T1:U187">1</span></span>) * <span class="mxinfo" id="T1:U188">sin(<span class="var type1" id="S14T1U243">L</span>)</span></span> + <span class="var type1" id="S11T1U244">ey</span></span>, <span class="mxinfo" id="T1:U191"><span class="var type1" id="S27T1U246">Z</span> * <span class="var type1" id="S10T1U247">ex</span></span></span>;</span></span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,46" id="srcline46"> 46</a></span><span class="line"><span class="mxinfo" id="T17:U149"><span class="mxinfo" id="T17:U151"><span class="mxinfo" id="T17:U153">    <span class="mxinfo" id="T20:U194"><span class="mxinfo" id="T1:U195">0</span> , <span class="mxinfo" id="T1:U196">0</span> , <span class="mxinfo" id="T1:U197"><span class="mxinfo" id="T1:U198"><span class="var type1" id="S28T1U253">C</span> * <span class="mxinfo" id="T1:U200">cos(<span class="var type1" id="S14T1U256">L</span>)</span></span> / <span class="mxinfo" id="T1:U202">2</span></span></span>;</span></span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,47" id="srcline47"> 47</a></span><span class="line"><span class="mxinfo" id="T17:U149"><span class="mxinfo" id="T17:U151"><span class="mxinfo" id="T17:U153">    <span class="mxinfo" id="T20:U203"><span class="mxinfo" id="T1:U204">0</span> , <span class="mxinfo" id="T1:U205">0</span> , <span class="mxinfo" id="T1:U206"><span class="mxinfo" id="T1:U207"><span class="var type1" id="S28T1U263">C</span> * <span class="mxinfo" id="T1:U209">sin(<span class="var type1" id="S14T1U266">L</span>)</span></span> / <span class="mxinfo" id="T1:U211">2</span></span></span>;</span></span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,48" id="srcline48"> 48</a></span><span class="line"><span class="mxinfo" id="T17:U149"><span class="mxinfo" id="T17:U151"><span class="mxinfo" id="T17:U153">    <span class="mxinfo" id="T20:U212"><span class="mxinfo" id="T1:U213">0</span> , <span class="mxinfo" id="T1:U214">0</span> , <span class="var type1" id="S27T1U271">Z</span></span>]</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,49" id="srcline49"> 49</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,50" id="srcline50"> 50</a></span><span class="line"><span class="comment">% calculate | lambda' * B |</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,51" id="srcline51"> 51</a></span><span class="line"><span class="mxinfo" id="T20:U216"><span class="var type1" id="S33T20U274">LtB</span> = <span class="mxinfo" id="T20:U218"><span class="mxinfo" id="T18:U219">[<span class="var type1" id="S16T1U278">pp</span> , <span class="var type1" id="S17T1U279">pex</span> , <span class="var type1" id="S18T1U280">pey</span> , <span class="var type1" id="S19T1U281">phx</span> , <span class="var type1" id="S20T1U282">phy</span> , <span class="var type1" id="S21T1U283">pL</span>]</span> * <span class="var type1" id="S32T17U284">B</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,52" id="srcline52"> 52</a></span><span class="line"><span class="mxinfo" id="T1:U227"><span class="var type1" id="S34T1U287">LtB_mag</span> = <span class="mxinfo" id="T1:U229">sqrt(<span class="mxinfo" id="T1:U230"><span class="mxinfo" id="T1:U231"><span class="mxinfo" id="T1:U232"><span class="mxinfo" id="T1:U233"><span class="var type1" id="S33T20U294">LtB</span>(<span class="mxinfo" id="T1:U235">1</span>)</span>^2</span> + <span class="mxinfo" id="T1:U236"><span class="mxinfo" id="T1:U237"><span class="var type1" id="S33T20U299">LtB</span>(<span class="mxinfo" id="T1:U239">2</span>)</span>^2</span></span> + <span class="mxinfo" id="T1:U240"><span class="mxinfo" id="T1:U241"><span class="var type1" id="S33T20U304">LtB</span>(<span class="mxinfo" id="T1:U243">3</span>)</span>^2</span></span>)</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,53" id="srcline53"> 53</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,54" id="srcline54"> 54</a></span><span class="line"><span class="comment">% optimal thrust direction by PMP</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,55" id="srcline55"> 55</a></span><span class="line"><span class="mxinfo" id="T20:U244"><span class="var type1" id="S35T20U309">alpha</span> = <span class="mxinfo" id="T20:U246"><span class="mxinfo" id="T20:U247">- <span class="var type1" id="S33T20U312">LtB</span></span> / <span class="var type1" id="S34T1U313">LtB_mag</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,56" id="srcline56"> 56</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,57" id="srcline57"> 57</a></span><span class="line"><span class="comment">% optimal thrust magnitude by PMP</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,58" id="srcline58"> 58</a></span><span class="line"><span class="mxinfo" id="T1:U250"><span class="var type1" id="S36T1U316">Sw</span> = <span class="mxinfo" id="T1:U252"><span class="mxinfo" id="T1:U253">- <span class="var type1" id="S7T1U319">Tmax</span></span> * ( <span class="mxinfo" id="T1:U255"><span class="mxinfo" id="T1:U256"><span class="var type1" id="S34T1U323">LtB_mag</span> / <span class="var type1" id="S15T1U324">m</span></span> + <span class="mxinfo" id="T1:U259"><span class="var type1" id="S22T1U326">pm</span> / <span class="var type1" id="S8T1U327">c</span></span></span>)</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,59" id="srcline59"> 59</a></span><span class="line"><span class="keyword">if</span> <span class="mxinfo" id="T2:U262"><span class="var type1" id="S36T1U331">Sw</span> &lt; <span class="mxinfo" id="T1:U264">0</span></span>; <span class="comment">% Engine turn 'On'</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,60" id="srcline60"> 60</a></span><span class="line">    <span class="mxinfo" id="T1:U265"><span class="var type1" id="S37T1U335">u</span> = <span class="mxinfo" id="T1:U267">1</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,61" id="srcline61"> 61</a></span><span class="line"><span class="keyword">else</span> <span class="comment">% Engine turn 'Off'</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,62" id="srcline62"> 62</a></span><span class="line">    <span class="mxinfo" id="T1:U268"><span class="var type1" id="S37T1U340">u</span> = <span class="mxinfo" id="T1:U270">0</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,63" id="srcline63"> 63</a></span><span class="line"><span class="keyword">end</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,64" id="srcline64"> 64</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,65" id="srcline65"> 65</a></span><span class="line"><span class="comment">% optimal thrust acceleration</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,66" id="srcline66"> 66</a></span><span class="line"><span class="mxinfo" id="T1:U271"><span class="var type1" id="S38T1U344">ar</span> = <span class="mxinfo" id="T1:U273"><span class="mxinfo" id="T1:U274"><span class="mxinfo" id="T1:U275"><span class="var type1" id="S37T1U348">u</span> * <span class="var type1" id="S7T1U349">Tmax</span></span> / <span class="var type1" id="S15T1U350">m</span></span> * <span class="mxinfo" id="T1:U279"><span class="var type1" id="S35T20U352">alpha</span>(<span class="mxinfo" id="T1:U281">1</span>)</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,67" id="srcline67"> 67</a></span><span class="line"><span class="mxinfo" id="T1:U282"><span class="var type1" id="S39T1U356">au</span> = <span class="mxinfo" id="T1:U284"><span class="mxinfo" id="T1:U285"><span class="mxinfo" id="T1:U286"><span class="var type1" id="S37T1U360">u</span> * <span class="var type1" id="S7T1U361">Tmax</span></span> / <span class="var type1" id="S15T1U362">m</span></span> * <span class="mxinfo" id="T1:U290"><span class="var type1" id="S35T20U364">alpha</span>(<span class="mxinfo" id="T1:U292">2</span>)</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,68" id="srcline68"> 68</a></span><span class="line"><span class="mxinfo" id="T1:U293"><span class="var type1" id="S40T1U368">ah</span> = <span class="mxinfo" id="T1:U295"><span class="mxinfo" id="T1:U296"><span class="mxinfo" id="T1:U297"><span class="var type1" id="S37T1U372">u</span> * <span class="var type1" id="S7T1U373">Tmax</span></span> / <span class="var type1" id="S15T1U374">m</span></span> * <span class="mxinfo" id="T1:U301"><span class="var type1" id="S35T20U376">alpha</span>(<span class="mxinfo" id="T1:U303">3</span>)</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,69" id="srcline69"> 69</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,70" id="srcline70"> 70</a></span><span class="line"><span class="comment">% state dynamics</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,71" id="srcline71"> 71</a></span><span class="line"><span class="mxinfo" id="T16:U304"><span class="var type1" id="S41T16U380">A_Bacc</span> = <span class="mxinfo" id="T16:U306"><span class="var type1" id="S31T16U382">A</span> + <span class="mxinfo" id="T16:U308"><span class="var type1" id="S32T17U384">B</span> * <span class="mxinfo" id="T24:U310">[<span class="var type1" id="S38T1U387">ar</span> ; <span class="var type1" id="S39T1U389">au</span> ; <span class="var type1" id="S40T1U391">ah</span>]</span></span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,72" id="srcline72"> 72</a></span><span class="line"><span class="mxinfo" id="T18:U314"><span class="mxinfo" id="T18:U315"><span class="var type1" id="S2T9U395">ydot</span>(<span class="mxinfo" id="T18:U317"><span class="mxinfo" id="T1:U318">1</span>:<span class="mxinfo" id="T1:U319">6</span></span>)</span> = <span class="var type1" id="S41T16U399">A_Bacc</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,73" id="srcline73"> 73</a></span><span class="line"><span class="mxinfo" id="T1:U321"><span class="mxinfo" id="T1:U322"><span class="var type1" id="S2T9U403">ydot</span>(<span class="mxinfo" id="T1:U324">7</span>)</span> = <span class="mxinfo" id="T1:U325"><span class="mxinfo" id="T1:U326"><span class="mxinfo" id="T1:U327">- <span class="var type1" id="S37T1U408">u</span></span> * <span class="var type1" id="S7T1U409">Tmax</span></span> / <span class="var type1" id="S8T1U410">c</span></span></span> ;</span></span>
<span class="srcline"><span class="lineno"><a href="32,74" id="srcline74"> 74</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,75" id="srcline75"> 75</a></span><span class="line"><span class="comment">% ---------------------------------------------------------</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,76" id="srcline76"> 76</a></span><span class="line"><span class="mxinfo" id="T1:U331"><span class="var type1" id="S42T1U413">dW_dex</span> = <span class="mxinfo" id="T1:U333">cos(<span class="var type1" id="S14T1U416">L</span>)</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,77" id="srcline77"> 77</a></span><span class="line"><span class="mxinfo" id="T1:U335"><span class="var type1" id="S43T1U419">dW_dey</span> = <span class="mxinfo" id="T1:U337">sin(<span class="var type1" id="S14T1U422">L</span>)</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,78" id="srcline78"> 78</a></span><span class="line"><span class="mxinfo" id="T1:U339"><span class="var type1" id="S44T1U425">dW_dL</span> = <span class="mxinfo" id="T1:U341"><span class="mxinfo" id="T1:U342"><span class="var type1" id="S11T1U428">ey</span> * <span class="mxinfo" id="T1:U344">cos(<span class="var type1" id="S14T1U431">L</span>)</span></span> - <span class="mxinfo" id="T1:U346"><span class="var type1" id="S10T1U433">ex</span> * <span class="mxinfo" id="T1:U348">sin(<span class="var type1" id="S14T1U436">L</span>)</span></span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,79" id="srcline79"> 79</a></span><span class="line"><span class="mxinfo" id="T1:U350"><span class="var type1" id="S45T1U439">dZ_dhx</span> = <span class="mxinfo" id="T1:U352">sin(<span class="var type1" id="S14T1U442">L</span>)</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,80" id="srcline80"> 80</a></span><span class="line"><span class="mxinfo" id="T1:U354"><span class="var type1" id="S46T1U445">dZ_dhy</span> = <span class="mxinfo" id="T1:U356">-<span class="mxinfo" id="T1:U357">cos(<span class="var type1" id="S14T1U449">L</span>)</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,81" id="srcline81"> 81</a></span><span class="line"><span class="mxinfo" id="T1:U359"><span class="var type1" id="S47T1U452">dZ_dL</span> = <span class="mxinfo" id="T1:U361"><span class="mxinfo" id="T1:U362"><span class="var type1" id="S12T1U455">hx</span>*<span class="mxinfo" id="T1:U364">cos(<span class="var type1" id="S14T1U458">L</span>)</span></span> + <span class="mxinfo" id="T1:U366"><span class="var type1" id="S13T1U460">hy</span>*<span class="mxinfo" id="T1:U368">sin(<span class="var type1" id="S14T1U463">L</span>)</span></span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,82" id="srcline82"> 82</a></span><span class="line"><span class="mxinfo" id="T1:U370"><span class="var type1" id="S48T1U466">dC_dhx</span> = <span class="mxinfo" id="T1:U372"><span class="mxinfo" id="T1:U373">2</span> * <span class="var type1" id="S12T1U469">hx</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,83" id="srcline83"> 83</a></span><span class="line"><span class="mxinfo" id="T1:U375"><span class="var type1" id="S49T1U472">dC_dhy</span> = <span class="mxinfo" id="T1:U377"><span class="mxinfo" id="T1:U378">2</span> * <span class="var type1" id="S13T1U475">hy</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,84" id="srcline84"> 84</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,85" id="srcline85"> 85</a></span><span class="line"><span class="mxinfo" id="T18:U380"><span class="var type1" id="S50T18U478">dCkep_dxx</span> = <span class="mxinfo" id="T18:U382">[<span class="mxinfo" id="T1:U383"><span class="mxinfo" id="T1:U384">1</span> / (<span class="mxinfo" id="T1:U385"><span class="mxinfo" id="T1:U386"><span class="mxinfo" id="T1:U387">2</span> * <span class="var type1" id="S24T1U487">W</span></span> * <span class="mxinfo" id="T1:U389">sqrt(<span class="mxinfo" id="T1:U390"><span class="var type1" id="S9T1U491">p</span> * <span class="var type1" id="S6T1U492">mu</span></span>)</span></span>)</span> , <span class="mxinfo" id="T1:U393"><span class="mxinfo" id="T1:U394"><span class="mxinfo" id="T1:U395">-<span class="mxinfo" id="T1:U396">sqrt(<span class="mxinfo" id="T1:U397"><span class="var type1" id="S9T1U499">p</span> / <span class="var type1" id="S6T1U500">mu</span></span>)</span></span> / <span class="mxinfo" id="T1:U400"><span class="var type1" id="S24T1U502">W</span>^2</span></span> * <span class="var type1" id="S42T1U504">dW_dex</span></span> , <span class="mxinfo" id="T1:U403"><span class="mxinfo" id="T1:U404"><span class="mxinfo" id="T1:U405">-<span class="mxinfo" id="T1:U406">sqrt(<span class="mxinfo" id="T1:U407"><span class="var type1" id="S9T1U511">p</span> / <span class="var type1" id="S6T1U512">mu</span></span>)</span></span> / <span class="mxinfo" id="T1:U410"><span class="var type1" id="S24T1U514">W</span>^2</span></span> * <span class="var type1" id="S43T1U516">dW_dey</span></span> , <span class="mxinfo" id="T1:U413">0</span> , <span class="mxinfo" id="T1:U414">0</span> , <span class="mxinfo" id="T1:U415"><span class="mxinfo" id="T1:U416"><span class="mxinfo" id="T1:U417">-<span class="mxinfo" id="T1:U418">sqrt(<span class="mxinfo" id="T1:U419"><span class="var type1" id="S9T1U525">p</span> / <span class="var type1" id="S6T1U526">mu</span></span>)</span></span> / <span class="mxinfo" id="T1:U422"><span class="var type1" id="S24T1U528">W</span>^2</span></span> * <span class="var type1" id="S44T1U530">dW_dL</span></span>]</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,86" id="srcline86"> 86</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,87" id="srcline87"> 87</a></span><span class="line"><span class="mxinfo" id="T25:U425"><span class="var type1" id="S51T25U533">dII_dxx</span> = <span class="mxinfo" id="T25:U427">[<span class="mxinfo" id="T18:U428"><span class="mxinfo" id="T1:U429"><span class="mxinfo" id="T1:U430">2</span> * <span class="var type1" id="S39T1U538">au</span></span> , <span class="mxinfo" id="T1:U432">0</span> , <span class="mxinfo" id="T1:U433">0</span> , <span class="mxinfo" id="T1:U434">0</span> , <span class="mxinfo" id="T1:U435">0</span> , <span class="mxinfo" id="T1:U436">0</span></span>;</span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,88" id="srcline88"> 88</a></span><span class="line"><span class="mxinfo" id="T25:U425"><span class="mxinfo" id="T25:U427">    <span class="mxinfo" id="T18:U437"><span class="mxinfo" id="T1:U438">0</span> , <span class="mxinfo" id="T1:U439"><span class="mxinfo" id="T1:U440"><span class="mxinfo" id="T1:U441"><span class="var type1" id="S42T1U549">dW_dex</span> * <span class="mxinfo" id="T1:U443">sin(<span class="var type1" id="S14T1U552">L</span>)</span></span> * <span class="var type1" id="S38T1U553">ar</span></span> + <span class="mxinfo" id="T1:U446">(<span class="mxinfo" id="T1:U447"><span class="mxinfo" id="T1:U448"><span class="var type1" id="S42T1U558">dW_dex</span> * <span class="mxinfo" id="T1:U450">cos(<span class="var type1" id="S14T1U561">L</span>)</span></span> + <span class="mxinfo" id="T1:U452">1</span></span>) * <span class="var type1" id="S39T1U563">au</span></span></span> , <span class="mxinfo" id="T1:U454"><span class="mxinfo" id="T1:U455"><span class="mxinfo" id="T1:U456"><span class="mxinfo" id="T1:U457"><span class="var type1" id="S43T1U568">dW_dey</span> * <span class="mxinfo" id="T1:U459">sin(<span class="var type1" id="S14T1U571">L</span>)</span></span> * <span class="var type1" id="S38T1U572">ar</span></span> + <span class="mxinfo" id="T1:U462"><span class="mxinfo" id="T1:U463"><span class="var type1" id="S43T1U575">dW_dey</span> * <span class="mxinfo" id="T1:U465">cos(<span class="var type1" id="S14T1U578">L</span>)</span></span> * <span class="var type1" id="S39T1U579">au</span></span></span> - <span class="mxinfo" id="T1:U468"><span class="var type1" id="S27T1U581">Z</span> * <span class="var type1" id="S40T1U582">ah</span></span></span> , <span class="mxinfo" id="T1:U471"><span class="mxinfo" id="T1:U472"><span class="mxinfo" id="T1:U473">- <span class="var type1" id="S45T1U586">dZ_dhx</span></span> * <span class="var type1" id="S11T1U587">ey</span></span> * <span class="var type1" id="S40T1U588">ah</span></span> , <span class="mxinfo" id="T1:U477"><span class="mxinfo" id="T1:U478"><span class="mxinfo" id="T1:U479">- <span class="var type1" id="S46T1U592">dZ_dhy</span></span> * <span class="var type1" id="S11T1U593">ey</span></span> * <span class="var type1" id="S40T1U594">ah</span></span> , <span class="mxinfo" id="T1:U483"><span class="mxinfo" id="T1:U484"><span class="mxinfo" id="T1:U485">(<span class="mxinfo" id="T1:U486"><span class="mxinfo" id="T1:U487"><span class="var type1" id="S44T1U601">dW_dL</span> * <span class="mxinfo" id="T1:U489">sin(<span class="var type1" id="S14T1U604">L</span>)</span></span> + <span class="mxinfo" id="T1:U491"><span class="var type1" id="S24T1U606">W</span> * <span class="mxinfo" id="T1:U493">cos(<span class="var type1" id="S14T1U609">L</span>)</span></span></span>) * <span class="var type1" id="S38T1U610">ar</span></span> + <span class="mxinfo" id="T1:U496">(<span class="mxinfo" id="T1:U497"><span class="mxinfo" id="T1:U498"><span class="mxinfo" id="T1:U499"><span class="var type1" id="S44T1U616">dW_dL</span> * <span class="mxinfo" id="T1:U501">cos(<span class="var type1" id="S14T1U619">L</span>)</span></span> - <span class="mxinfo" id="T1:U503"><span class="var type1" id="S24T1U621">W</span> * <span class="mxinfo" id="T1:U505">sin(<span class="var type1" id="S14T1U624">L</span>)</span></span></span> - <span class="mxinfo" id="T1:U507">sin(<span class="var type1" id="S14T1U627">L</span>)</span></span>) * <span class="var type1" id="S39T1U628">au</span></span></span> - <span class="mxinfo" id="T1:U510"><span class="mxinfo" id="T1:U511"><span class="var type1" id="S47T1U631">dZ_dL</span> * <span class="var type1" id="S11T1U632">ey</span></span> * <span class="var type1" id="S40T1U633">ah</span></span></span></span>;</span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,89" id="srcline89"> 89</a></span><span class="line"><span class="mxinfo" id="T25:U425"><span class="mxinfo" id="T25:U427">    <span class="mxinfo" id="T18:U515"><span class="mxinfo" id="T1:U516">0</span> , <span class="mxinfo" id="T1:U517"><span class="mxinfo" id="T1:U518"><span class="mxinfo" id="T1:U519"><span class="mxinfo" id="T1:U520"><span class="mxinfo" id="T1:U521">-<span class="var type1" id="S42T1U641">dW_dex</span></span> * <span class="mxinfo" id="T1:U523">cos(<span class="var type1" id="S14T1U644">L</span>)</span></span> * <span class="var type1" id="S38T1U645">ar</span></span> + <span class="mxinfo" id="T1:U526"><span class="mxinfo" id="T1:U527"><span class="var type1" id="S42T1U648">dW_dex</span> * <span class="mxinfo" id="T1:U529">sin(<span class="var type1" id="S14T1U651">L</span>)</span></span> * <span class="var type1" id="S39T1U652">au</span></span></span> + <span class="mxinfo" id="T1:U532"><span class="var type1" id="S27T1U654">Z</span> * <span class="var type1" id="S40T1U655">ah</span></span></span> , <span class="mxinfo" id="T1:U535"><span class="mxinfo" id="T1:U536"><span class="mxinfo" id="T1:U537"><span class="mxinfo" id="T1:U538">-<span class="var type1" id="S43T1U660">dW_dey</span></span> * <span class="mxinfo" id="T1:U540">cos(<span class="var type1" id="S14T1U663">L</span>)</span></span> * <span class="var type1" id="S38T1U664">ar</span></span> + <span class="mxinfo" id="T1:U543">(<span class="mxinfo" id="T1:U544"><span class="mxinfo" id="T1:U545"><span class="var type1" id="S43T1U669">dW_dey</span> * <span class="mxinfo" id="T1:U547">sin(<span class="var type1" id="S14T1U672">L</span>)</span></span> + <span class="mxinfo" id="T1:U549">1</span></span>) * <span class="var type1" id="S39T1U674">au</span></span></span> , <span class="mxinfo" id="T1:U551"><span class="mxinfo" id="T1:U552"><span class="var type1" id="S45T1U677">dZ_dhx</span> * <span class="var type1" id="S10T1U678">ex</span></span> * <span class="var type1" id="S40T1U679">ah</span></span> , <span class="mxinfo" id="T1:U556"><span class="mxinfo" id="T1:U557"><span class="var type1" id="S46T1U682">dZ_dhy</span> * <span class="var type1" id="S10T1U683">ex</span></span> * <span class="var type1" id="S40T1U684">ah</span></span> , <span class="mxinfo" id="T1:U561"><span class="mxinfo" id="T1:U562"><span class="mxinfo" id="T1:U563">(<span class="mxinfo" id="T1:U564"><span class="mxinfo" id="T1:U565"><span class="mxinfo" id="T1:U566">-<span class="var type1" id="S44T1U692">dW_dL</span></span> * <span class="mxinfo" id="T1:U568">cos(<span class="var type1" id="S14T1U695">L</span>)</span></span> + <span class="mxinfo" id="T1:U570"><span class="var type1" id="S24T1U697">W</span> * <span class="mxinfo" id="T1:U572">sin(<span class="var type1" id="S14T1U700">L</span>)</span></span></span>) * <span class="var type1" id="S38T1U701">ar</span></span> + <span class="mxinfo" id="T1:U575">(<span class="mxinfo" id="T1:U576"><span class="mxinfo" id="T1:U577"><span class="mxinfo" id="T1:U578"><span class="var type1" id="S44T1U707">dW_dL</span> * <span class="mxinfo" id="T1:U580">sin(<span class="var type1" id="S14T1U710">L</span>)</span></span> + <span class="mxinfo" id="T1:U582"><span class="var type1" id="S24T1U712">W</span> * <span class="mxinfo" id="T1:U584">cos(<span class="var type1" id="S14T1U715">L</span>)</span></span></span> + <span class="mxinfo" id="T1:U586">cos(<span class="var type1" id="S14T1U718">L</span>)</span></span>) * <span class="var type1" id="S39T1U719">au</span></span></span> + <span class="mxinfo" id="T1:U589"><span class="mxinfo" id="T1:U590"><span class="var type1" id="S47T1U722">dZ_dL</span> * <span class="var type1" id="S10T1U723">ex</span></span> * <span class="var type1" id="S40T1U724">ah</span></span></span></span>;</span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,90" id="srcline90"> 90</a></span><span class="line"><span class="mxinfo" id="T25:U425"><span class="mxinfo" id="T25:U427">    <span class="mxinfo" id="T18:U594"><span class="mxinfo" id="T1:U595">0</span> , <span class="mxinfo" id="T1:U596">0</span> , <span class="mxinfo" id="T1:U597">0</span> , <span class="mxinfo" id="T1:U598"><span class="mxinfo" id="T1:U599"><span class="mxinfo" id="T1:U600"><span class="var type1" id="S40T1U732">ah</span> / <span class="mxinfo" id="T1:U602">2</span></span> * <span class="mxinfo" id="T1:U603">cos(<span class="var type1" id="S14T1U736">L</span>)</span></span> * <span class="var type1" id="S48T1U737">dC_dhx</span></span> , <span class="mxinfo" id="T1:U606"><span class="mxinfo" id="T1:U607"><span class="mxinfo" id="T1:U608"><span class="var type1" id="S40T1U741">ah</span> / <span class="mxinfo" id="T1:U610">2</span></span> * <span class="mxinfo" id="T1:U611">cos(<span class="var type1" id="S14T1U745">L</span>)</span></span> * <span class="var type1" id="S49T1U746">dC_dhy</span></span> , <span class="mxinfo" id="T1:U614"><span class="mxinfo" id="T1:U615"><span class="mxinfo" id="T1:U616"><span class="mxinfo" id="T1:U617">- <span class="var type1" id="S40T1U751">ah</span></span> / <span class="mxinfo" id="T1:U619">2</span></span> * <span class="var type1" id="S28T1U753">C</span></span> * <span class="mxinfo" id="T1:U621">sin(<span class="var type1" id="S14T1U756">L</span>)</span></span></span>;</span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,91" id="srcline91"> 91</a></span><span class="line"><span class="mxinfo" id="T25:U425"><span class="mxinfo" id="T25:U427">    <span class="mxinfo" id="T18:U623"><span class="mxinfo" id="T1:U624">0</span> , <span class="mxinfo" id="T1:U625">0</span>, <span class="mxinfo" id="T1:U626">0</span>, <span class="mxinfo" id="T1:U627"><span class="mxinfo" id="T1:U628"><span class="mxinfo" id="T1:U629"><span class="var type1" id="S40T1U764">ah</span> / <span class="mxinfo" id="T1:U631">2</span></span> * <span class="mxinfo" id="T1:U632">sin(<span class="var type1" id="S14T1U768">L</span>)</span></span> * <span class="var type1" id="S48T1U769">dC_dhx</span></span> , <span class="mxinfo" id="T1:U635"><span class="mxinfo" id="T1:U636"><span class="mxinfo" id="T1:U637"><span class="var type1" id="S40T1U773">ah</span> / <span class="mxinfo" id="T1:U639">2</span></span> * <span class="mxinfo" id="T1:U640">sin(<span class="var type1" id="S14T1U777">L</span>)</span></span> * <span class="var type1" id="S49T1U778">dC_dhy</span></span> , <span class="mxinfo" id="T1:U643"><span class="mxinfo" id="T1:U644"><span class="mxinfo" id="T1:U645"><span class="var type1" id="S40T1U782">ah</span> / <span class="mxinfo" id="T1:U647">2</span></span> * <span class="var type1" id="S28T1U784">C</span></span> * <span class="mxinfo" id="T1:U649">cos(<span class="var type1" id="S14T1U787">L</span>)</span></span></span>;</span></span></span></span>
<span class="srcline"><span class="lineno"><a href="32,92" id="srcline92"> 92</a></span><span class="line"><span class="mxinfo" id="T25:U425"><span class="mxinfo" id="T25:U427">    <span class="mxinfo" id="T18:U651"><span class="mxinfo" id="T1:U652"><span class="mxinfo" id="T1:U653"><span class="mxinfo" id="T1:U654"><span class="mxinfo" id="T1:U655">-2</span> * <span class="var type1" id="S6T1U794">mu</span></span> * <span class="mxinfo" id="T1:U657"><span class="var type1" id="S24T1U796">W</span>^3</span></span> / <span class="mxinfo" id="T1:U659"><span class="var type1" id="S9T1U799">p</span>^3</span></span> , <span class="mxinfo" id="T1:U661"><span class="mxinfo" id="T1:U662"><span class="mxinfo" id="T1:U663"><span class="mxinfo" id="T1:U664"><span class="var type1" id="S6T1U805">mu</span> / <span class="mxinfo" id="T1:U666"><span class="var type1" id="S9T1U807">p</span>^2</span></span> * <span class="mxinfo" id="T1:U668">3</span></span> * <span class="mxinfo" id="T1:U669"><span class="var type1" id="S24T1U811">W</span>^2</span></span> * <span class="var type1" id="S42T1U813">dW_dex</span></span> , <span class="mxinfo" id="T1:U672"><span class="mxinfo" id="T1:U673"><span class="mxinfo" id="T1:U674"><span class="mxinfo" id="T1:U675"><span class="var type1" id="S6T1U818">mu</span> / <span class="mxinfo" id="T1:U677"><span class="var type1" id="S9T1U820">p</span>^2</span></span> * <span class="mxinfo" id="T1:U679">3</span></span> * <span class="mxinfo" id="T1:U680"><span class="var type1" id="S24T1U824">W</span>^2</span></span> * <span class="var type1" id="S43T1U826">dW_dey</span></span> , <span class="mxinfo" id="T1:U683"><span class="var type1" id="S45T1U828">dZ_dhx</span> * <span class="var type1" id="S40T1U829">ah</span></span> , <span class="mxinfo" id="T1:U686"><span class="var type1" id="S46T1U831">dZ_dhy</span> * <span class="var type1" id="S40T1U832">ah</span></span> , <span class="mxinfo" id="T1:U689"><span class="mxinfo" id="T1:U690"><span class="mxinfo" id="T1:U691"><span class="mxinfo" id="T1:U692"><span class="mxinfo" id="T1:U693"><span class="var type1" id="S6T1U838">mu</span> / <span class="mxinfo" id="T1:U695"><span class="var type1" id="S9T1U840">p</span>^2</span></span> * <span class="mxinfo" id="T1:U697">3</span></span> * <span class="mxinfo" id="T1:U698"><span class="var type1" id="S24T1U844">W</span>^2</span></span> * <span class="var type1" id="S44T1U846">dW_dL</span></span> + <span class="mxinfo" id="T1:U701"><span class="var type1" id="S47T1U848">dZ_dL</span> * <span class="var type1" id="S40T1U849">ah</span></span></span></span>]</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,93" id="srcline93"> 93</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,94" id="srcline94"> 94</a></span><span class="line"><span class="mxinfo" id="T16:U704"><span class="var type1" id="S52T16U852">II</span> = <span class="mxinfo" id="T16:U706"><span class="var type1" id="S41T16U854">A_Bacc</span> / <span class="var type1" id="S29T1U855">Ckep</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,95" id="srcline95"> 95</a></span><span class="line"><span class="mxinfo" id="T18:U709"><span class="var type1" id="S53T18U858">dpp</span> = <span class="mxinfo" id="T18:U711"><span class="mxinfo" id="T18:U712">- <span class="mxinfo" id="T18:U713">[<span class="var type1" id="S16T1U863">pp</span> , <span class="var type1" id="S17T1U864">pex</span> , <span class="var type1" id="S18T1U865">pey</span> , <span class="var type1" id="S19T1U866">phx</span> , <span class="var type1" id="S20T1U867">phy</span> , <span class="var type1" id="S21T1U868">pL</span>]</span></span> * (<span class="mxinfo" id="T25:U720"><span class="mxinfo" id="T25:U721"><span class="var type1" id="S29T1U872">Ckep</span> * <span class="var type1" id="S51T25U873">dII_dxx</span></span> + <span class="mxinfo" id="T25:U724"><span class="var type1" id="S52T16U875">II</span> * <span class="var type1" id="S50T18U876">dCkep_dxx</span></span></span>)</span></span>; </span></span>
<span class="srcline"><span class="lineno"><a href="32,96" id="srcline96"> 96</a></span><span class="line"><span class="mxinfo" id="T1:U727"><span class="var type1" id="S54T1U879">dpm</span> = <span class="mxinfo" id="T1:U729"><span class="mxinfo" id="T1:U730"><span class="mxinfo" id="T1:U731"><span class="mxinfo" id="T1:U732">- <span class="var type1" id="S37T1U884">u</span></span> * <span class="var type1" id="S7T1U885">Tmax</span></span> * <span class="var type1" id="S34T1U886">LtB_mag</span></span> / <span class="mxinfo" id="T1:U736"><span class="var type1" id="S15T1U888">m</span>^2</span></span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,97" id="srcline97"> 97</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,98" id="srcline98"> 98</a></span><span class="line"><span class="comment">% co-state dynamics</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,99" id="srcline99"> 99</a></span><span class="line"><span class="mxinfo" id="T18:U738"><span class="mxinfo" id="T18:U739"><span class="var type1" id="S2T9U893">ydot</span>(<span class="mxinfo" id="T18:U741"><span class="mxinfo" id="T1:U742">8</span>:<span class="mxinfo" id="T1:U743">13</span></span>)</span> = <span class="mxinfo" id="T16:U744"><span class="var type1" id="S53T18U898">dpp</span>'</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,100" id="srcline100">100</a></span><span class="line"><span class="mxinfo" id="T1:U746"><span class="mxinfo" id="T1:U747"><span class="var type1" id="S2T9U902">ydot</span>(<span class="mxinfo" id="T1:U749">14</span>)</span> = <span class="var type1" id="S54T1U904">dpm</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="32,101" id="srcline101">101</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="32,102" id="srcline102">102</a></span><span class="line"><span class="keyword">end</span></span></span>
<span class="srcline"><span class="lineno"><a href="32,103" id="srcline103">103</a></span><span class="line"><span class="comment">%----------------------------------------------------------------</span></span></span>
</pre>
